<ul class="nav nav-tabs">
	<li>
		<?php echo $this->Html->link('文字回复',array('plugin'=>'wechat','controller'=>'WxMsg','action'=>'basic'));?>
	</li>
	<li class="active">
		<?php echo $this->Html->link('<i class="fa fa-plus"></i> 添加文字回复',array('plugin'=>'wechat','controller'=>'WxMsg','action'=>'basic_add'),array('escape'=>false));?>
	</li>
</ul>
<style type="text/css">
	.help-block em{display:inline-block;width:10em;font-weight:bold;font-style:normal;}
</style>
 <div class="clearfix ng-scope" ng-controller="replyForm">
	<form id="reply-form" class="form-horizontal form ng-pristine ng-valid" action="./index.php?c=platform&amp;a=reply&amp;do=post&amp;m=basic&amp;rid=0" method="post" enctype="multipart/form-data">
		<div class="form-group">
			<div class="col-sm-12">
				<div class="panel panel-default">
					<div class="panel-heading">添加回复规则 <span class="text-muted">删除，修改规则、关键字以及回复后，请提交以保存操作。</span></div>
					<ul class="list-group">
						<li class="list-group-item">
							<div class="form-group">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">回复规则名称</label>
								<div class="col-sm-6 col-md-8 col-xs-12">
									<input type="text" class="form-control" placeholder="请输入回复规则的名称" name="name" value="">
									<span class="help-block">
										您可以给这条规则起一个名字, 方便下次修改和查看. <br>
										<strong class="text-danger">选择高级设置: 将会提供一系列的高级选项供专业用户使用.</strong>
									</span>
								</div>
								<div class="col-sm-3 col-md-2">
									<div class="checkbox">
										<label>
											<input type="checkbox" ng-model="reply.advSetting" class="ng-pristine ng-untouched ng-valid"> 高级设置
										</label>
									</div>
								</div>
							</div>
							<div class="form-group ng-hide" ng-show="reply.advSetting">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
								<div class="col-sm-9">
									<label class="radio-inline">
										<input type="radio" name="status" value="1" checked="checked"> 启用
									</label>
									<label class="radio-inline">
										<input type="radio" name="status" value="0"> 禁用
									</label>
									<span class="help-block">您可以临时禁用这条回复.</span>
								</div>
							</div>
							<div class="form-group ng-hide" ng-show="reply.advSetting">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">置顶回复</label>
								<div class="col-sm-9">
									<label class="radio-inline">
										<input type="radio" name="istop" ng-model="reply.entry.istop" ng-value="1" value="1" class="ng-pristine ng-untouched ng-valid"> 置顶
									</label>
									<label class="radio-inline">
										<input type="radio" name="istop" ng-model="reply.entry.istop" ng-value="0" value="0" checked="checked" class="ng-pristine ng-untouched ng-valid"> 普通
									</label>
									<span class="help-block">“置顶”时无论在什么情况下均能触发且使终保持最优先级</span>
								</div>
							</div>
							<div class="form-group ng-hide" ng-show="reply.advSetting &amp;&amp; !reply.entry.istop">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">优先级</label>
								<div class="col-sm-9">
									<input type="text" class="form-control" placeholder="输入这条回复规则优先级" name="displayorder_rule" value="">
									<span class="help-block">规则优先级，越大则越靠前，最大不得超过254</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">触发关键字</label>
								<div class="col-sm-6 col-md-8 col-xs-12">
									<input type="hidden" name="rid" value="0">
									<input type="text" class="form-control keyword ng-pristine ng-untouched ng-valid" placeholder="请输入触发关键字" ng-model="trigger.items.default" id="keywordinput" onblur="checkKeyWord($(this));" data-type="keyword">
									<span class="help-block"></span>
									<input type="hidden" name="keywords">
									<span class="help-block">
										当用户的对话内容符合以上的关键字定义时，会触发这个回复定义。多个关键字请使用逗号隔开。<a href="javascript:;" id="keyword" data-original-title="" title=""><i class="fa fa-github-alt"></i> 表情</a> <br>
										<strong class="text-danger">选择高级触发: 将会提供一系列的高级触发方式供专业用户使用(注意: 如果你不了解, 请不要使用). </strong>
									</span>
								</div>
								<div class="col-sm-3 col-md-2">
									<div class="checkbox">
										<label>
											<input type="checkbox" ng-model="reply.advTrigger" class="ng-pristine ng-untouched ng-valid"> 高级触发
										</label>
									</div>
								</div>
							</div>
							<div class="form-group ng-hide" ng-show="reply.advTrigger">
								<label class="col-xs-12 col-sm-3 col-md-2 control-label">高级触发列表</label>
								<div class="col-sm-9">
									<div class="panel panel-default tab-content">
										<div class="panel-heading">
											<ul class="nav nav-pills">
												<li class="active"><a href="#contains" data-toggle="tab">包含关键字</a></li>
												<li><a href="#regexp" data-toggle="tab">正则表达式模式匹配</a></li>
												<li><a href="#trustee" data-toggle="tab">直接接管</a></li>
											</ul>
										</div>
										<ul class="tab-pane list-group active" id="contains">
											<!-- ngRepeat: entry in trigger.items.contains -->
										</ul>
										<ul class="tab-pane list-group" id="regexp">
											<!-- ngRepeat: entry in trigger.items.regexp -->
										</ul>
										<ul class="tab-pane list-group" id="trustee">
											<!-- ngRepeat: entry in trigger.items.trustee -->
										</ul>
										<div class="panel-footer">
											<a href="javascript:;" class="btn btn-default ng-binding" ng-click="trigger.addItem();" ng-bind="'添加' + trigger.labels[trigger.active]">添加包含关键字</a>
											<span class="help-block ng-binding" ng-bind-html="trigger.descriptions[trigger.active]">用户进行交谈时，对话中包含上述关键字就执行这条规则。</span>
										</div>
									</div>
								</div>
							</div>
						</li>
					</ul>
				</div> 
			</div>
		</div>
		
		<div class="form-group">
			<div class="col-sm-12">
				<div class="panel panel-default">
	<div class="panel-heading">
		回复内容
	</div>
	<ul class="list-group">
		<!-- ngRepeat: item in context.items --><li class="row list-group-item ng-scope" ng-repeat="item in context.items">
			<div class="block">
				<div class="col-xs-12 col-sm-12">
					<textarea class="form-control content ng-pristine ng-untouched ng-valid" ng-hide="item.saved" placeholder="添加要回复的内容" ng-model="item.content" rows="4" onkeyup="if (this.value.split('\n').length>4) this.rows=this.value.split('\n').length;"></textarea>
					<p class="form-control-static ng-binding ng-hide" ng-show="item.saved" ng-bind-html="item.content | nl2br"></p>
				</div>
				<div class="col-xs-12 col-sm-12 help-block">您还可以使用表情和链接。<a class="emotion-triggers" href="javascript:;" ng-init="initEmotion(this);" data-original-title="" title=""><i class="fa fa-github-alt"></i> 表情</a> <a class="emoji-triggers" href="javascript:;" ng-click="selectEmoji(this)" title="添加表情"><i class="fa fa-github-alt"></i> Emoji</a></div>
			</div>
			<div class="col-sm-12 text-right">
				<div class="btn-group">
					<a href="javascript:;" class="btn btn-default ng-binding" ng-click="context.saveItem(item);">保存</a>
					<a href="javascript:;" class="btn btn-default" ng-click="context.removeItem(item);">删除</a>
				</div>
			</div>
		</li><!-- end ngRepeat: item in context.items -->
	</ul>
	<!-- <div class="form-group">
		<div class="col-sm-9">
			<textarea type="text" name="welcome" class="form-control" id="welcomeinput" autocomplete="off" /></textarea>
			<div class="help-block">设置用户添加公众帐号好友时，发送的欢迎信息。<a href="javascript:;" id="welcome"><i class="fa fa-github-alt"></i> 表情</a></div>
		</div>
	</div> -->
	<div class="panel-footer">
		<a href="javascript:;" class="btn btn-default" ng-click="context.addItem();">添加回复条目</a>
		<span class="help-block">添加多条回复内容时, 随机回复其中一条</span>
	</div>
</div>
		</div>
		</div>
		<div class="form-group">
			<div class="col-sm-12">
				<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
				<input type="hidden" name="token" value="e446e455">
			</div>
		</div>
	</form>
</div>
